//	Author:				Joe Audette
//	Created:			2004-08-15
//	Last Modified:		2010-05-23
//		
// The use and distribution terms for this software are covered by the 
// Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
// which can be found in the file CPL.TXT at the root of this distribution.
// By using this software in any fashion, you are agreeing to be bound by 
// the terms of this license.
//
// You must not remove this notice, or any other, from this software.

using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using mojoPortal.Business;
using mojoPortal.Web.Framework;
using mojoPortal.Web.UI;
using mojoPortal.Web;
using Resources;

namespace ud_Search
{
    public partial class SearchModule : SiteModuleControl
    {
        private SearchConfiguration config = new SearchConfiguration();
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            this.Load += new EventHandler(Page_Load);
            this.EnableViewState = false;
        }

        protected virtual void Page_Load(object sender, EventArgs e)
        {
            LoadSettings();
            PopulateLabels();
            PopulateControls();
        }

        private void PopulateControls()
        {
        }

        protected virtual void PopulateLabels()
        {

        }


        protected virtual void LoadSettings()
        {
            pnlContainer.ModuleId = ModuleId;
            config = new SearchConfiguration(Settings);
            if (!config.CustomCssClass.Equals(string.Empty)) { pnlContainer.CssClass += " " + config.CustomCssClass; }
            searchInput.ButtonCssClass = config.ButtonCssClass;
            searchInput.ImageUrl = config.ImageUrl;
            searchInput.LinkOnly = config.LinkOnly;
            searchInput.ListItemCss = config.ListItemCss;
            searchInput.OverrideWatermark = config.OverrideWatermark;
            searchInput.RenderAsListItem = config.RenderAsListItem;
            searchInput.TextBoxCssClass = config.TextBoxCssClass;
            searchInput.UseHeading = config.UseHeading;
            searchInput.UseLeftSeparator = config.UseLeftSeparator;
            searchInput.UseWatermark = config.UseWatermark;
            searchInput.ButtonText = config.ButtonText;
            lblHeader.Text = config.HeaderText;
            lblFooter.Text = config.FooterText;
        }

    }
}
